<?php
/*
 *  MySQL Database Functions
 *	author: Parnaki Zsolt
 */
 
/* Defining DB Access token */
define(DB_USER, '');
define(DB_PASSWORD, '');
define(DB_URI, '');
define(DB_NAME, '');

/*
 * Connects to the database
 * @return Database handle
 */
function open_db() {
	$connection = mysql_connect(DB_URI, DB_USER, DB_PASSWORD);
        mysql_select_db(DB_NAME);
	if (!$connection) {
		printf("Connect failed: %s\n", mysql_error());
		exit();
	} 

	return $connection;
}

/*
 * Closes the database
 * @param $conn Database handle
 */
function close_db($conn) {
	mysql_close($conn);
}

?>